from django.db import models
from django.utils import timezone
from django.db.backends.mysql.base import DatabaseFeatures # 关键设置
DatabaseFeatures.supports_microsecond_precision = False # 关键设置

# Create your models here.

def get_time():
    return timezone.localtime(timezone.now())


class History(models.Model):
    text = models.CharField(max_length=3230)
    Ner = models.CharField(max_length=3230)
    Re = models.CharField(max_length=3230)
    add_time = models.DateTimeField(auto_now_add=True)

    #add_time = models.DateTimeField(default=get_time)
    # add_time = timezone.now().strftime("%Y-%m-%d %H:%M:%S")
    username = models.CharField(max_length=20)

    def __str__(self):
        return "具体查询内容：%s\t 查询时间：%s\t 用户名称：%s" % (self.text, self.add_time, self.username)
